home *** CD-ROM | disk | FTP | other *** search
Prolog Source | 1986-10-07 | 842 b | 35 lines |
- /* Program 4 */
- /*
- Read page 26 very carefully. This is an important
- part of the tutor. Note, that to test that
- male(X) is not(smoker(X)) the value of X must
- be bound before Prolog can tell that smoker(X)
- is not a smoker. This means that you can not
- write: sophie_could_date(X) if
- not(smoker(X)) and male(X).
- */
-
- domains
- person = symbol
-
- predicates
- male(person)
- smoker(person)
- vegetarian(person)
- sophie_could_date(person)
-
- goal
- sophie_could_date(X) and
- write("a possible date for sophie is ",X) and nl.
-
- clauses
- male(joshua).
- male(bill).
- male(tom).
- smoker(guiseppe).
- smoker(tom).
- vegetarian(joshua).
- vegetarian(tom).
- sophie_could_date(X) if male(X) and not(smoker(X)).
- sophie_could_date(X) if male(X) and vegetarian(X).